/*
 * Copyright (C) 2010, 2009 Matthias Kaehlcke <matthias@kaehlcke.net>
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 */

#include <config.h>
#include <led.h>
#include <asm/io.h>
#include <asm/arch/s3c24x0_cpu.h>

void led_ctrl(int index, int state)
{
	struct s3c24x0_gpio *led_ctrl = s3c24x0_get_base_gpio();
	
	writel(readl(&led_ctrl->gpbcon) & LED_CTRL_MASK(index+4) | LED_CONF(index+4), &led_ctrl->gpbcon);
	
	if(state == STATUS_LED_ON)
		writel(readl(&led_ctrl->gpbdat) & LED_STATE_MASK(index+4) | LED_STATE_CONF(index+4, 0), &led_ctrl->gpbdat);
	else
		writel(readl(&led_ctrl->gpbdat) & LED_STATE_MASK(index+4) | LED_STATE_CONF(index+4, 1), &led_ctrl->gpbdat);

	return;
}
